package com.asia5b.a5mall.member.adapter

import android.view.View
import com.asia5b.a5mall.member.R
import com.asia5b.a5mall.middleware.model.bean.TabRegionBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * Created by zhangyuncai on 2020/4/18.
 */
class RegionTabAdapter(list: ArrayList<TabRegionBean>) :
        BaseQuickAdapter<TabRegionBean, BaseViewHolder>(R.layout.item_region_tab_adapter, list) {
    //当前选中栏
    var selectPosition = 0
    override fun convert(helper: BaseViewHolder, item: TabRegionBean) {
        if (item.selectRegionModel != null) {
            helper.setText(R.id.tv_region_tab_name, item.selectRegionModel!!.name)
        } else {
            helper.setText(R.id.tv_region_tab_name, R.string.请选择)
        }
        val view_region_tab_line = helper.getView<View>(R.id.view_region_tab_line)
        view_region_tab_line.isSelected = (selectPosition == helper.layoutPosition)
    }
}